/******************************************************************************
**                                                                           **
** SEWEN - Simple Embeddable Wiki Engine - http://sewen.codeplex.com         **
**                                                                           **
** This SQL script will create the single required table for storing wiki    **
** pages data.                                                               **
**                                                                           **
** This script works for Microsoft SQL Server Express and higher.            **
**                                                                           **
******************************************************************************/

-- Create table for storing versions of pages
CREATE TABLE Pages(
    Slug        nvarchar(100)    NOT NULL,
    Version     datetime         NOT NULL,
    UserName    nvarchar(100)    NULL,
    IpAddress   nvarchar(40)     NOT NULL,
    Title       nvarchar(max)    NOT NULL,
    Body        nvarchar(max)    NOT NULL,
    Comment     nvarchar(max)    NULL,
)

-- Add primary key (not required, but recommended)
ALTER TABLE Pages ADD CONSTRAINT PK_Pages PRIMARY KEY CLUSTERED (Slug ASC, Version ASC)
